<?php

class event extends thingy {

/**
 * Obviously, this needs to be more flexible later.
 */
function allevents( $day = '00000000' ) {
    global $db;

    if ( $day == '00000000' ) {
        $day = date('Ymd');
    }

    // Create bogus object, for convenience
    $e = new event();
    $table = $e->table;

    $ret = array();
    $q = $db->safe_query( "SELECT ID FROM %s
                           WHERE ds = '%s'
                           ORDER BY ds, starttime ",
                           $table, $day );
    $rows = $db->get_results( $q );
    if ( $rows ) {
        foreach ( $rows as $row ) {
            $event = new event( array ( 'ID' => $row->ID ));
            $ret[] = $event;
        }
    } else {
        $ret = array();
    }
    return $ret;
}

}

?>
